package com.idrive.service;

import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.IBinder;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.widget.Toast;

import com.idrive.listener.IDriveCallListener;
import com.idrive.listener.IDriveSmsListener;

public class IDriveService extends Service {

	private IDriveCallListener callListener = new IDriveCallListener(IDriveService.this);
	

	@Override
	public void onDestroy() {
		Toast.makeText(this, "iDrive - Driver Assistant Stopped...", Toast.LENGTH_LONG).show();
		TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
		telephonyManager.listen(callListener, PhoneStateListener.LISTEN_NONE);
	}

	@Override
	public void onStart(Intent intent, int startid) {
		Toast.makeText(this, "iDrive - Driver Assistant Started...", Toast.LENGTH_LONG).show();
		TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
		telephonyManager.listen(callListener, PhoneStateListener.LISTEN_CALL_STATE);

	}

	@Override
	public IBinder onBind(Intent arg0) {
		// TODO Auto-generated method stub
		return null;
	}

}
